home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / jpeg / libCLRjpeg4 / example / jsave.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  1KB  |  45 lines

  1. #include <stdio.h>
  2. #include <gl.h>
  3.  
  4. main(argc,argv)
  5. int argc;
  6. char *argv[];
  7. {
  8.     if(argc == 2) {
  9.         noborder();
  10.         prefposition(0,0,0,0);
  11.         winopen("");
  12.         RGBmode();
  13.         fullscrn();
  14.         gconfig();
  15.         SaveJPEGImageScreen(argv[1],0,0,getgdesc(GD_XPMAX)-1,getgdesc(GD_YPMAX)-1);
  16.     } else if(argc == 6) {
  17.         noborder();
  18.         prefposition(0,0,0,0);
  19.         winopen("");
  20.         RGBmode();
  21.         fullscrn();
  22.         gconfig();
  23.         SaveJPEGImageScreen(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]));
  24.     } else {
  25.         Usage(argv[0]);
  26.         exit(2);
  27.     }
  28. }
  29.  
  30. Usage(char *progname) {
  31.     fprintf(stderr,"usage: %s outfile [x1 y1 x2 y2]\n",progname);
  32.     fprintf(stderr,"outfile     - the filename to give the saved JPEG image\n");
  33.     fprintf(stderr,"x1 y1 x2 y2 - the screen coordinates to save.  If\n");
  34.     fprintf(stderr,"not specified, the complete screen will be saved.\n\n");
  35.     fprintf(stderr,"This program will save a jpeg image\n");
  36.     fprintf(stderr,"(in JFIF format and no arithmetic coding)\n");
  37.     fprintf(stderr,"of a section of an Iris screen.  The encoding\n");
  38.     fprintf(stderr,"process utilizes the Independent JPEG Group's\n");
  39.     fprintf(stderr,"software (%s).\n",GetJPEGVersion());
  40.     fprintf(stderr,"IRIS GL(tm) Adaption is\n");
  41.     fprintf(stderr,"(c) 1992 Rodney Hoinkes, Centre for Landscape Research\n");
  42.     fprintf(stderr,"This software is public domain.\n");
  43.     exit(0);
  44. }
  45.